# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=amap
pkgver=5.4
pkgrel=5
epoch=1
pkgdesc='Next-generation tool for assisting network penetration testing.'
arch=('x86_64' 'aarch64')
license=('GPL2' 'custom')
depends=('pcre' 'openssl' 'ca-certificates')
url='http://freeworld.thc.org/releases.php'
makedepends=('git')
source=("git+https://github.com/BlackArch/amap.git"
        'pcre.patch')
sha512sums=('SKIP'
            'd54886d9e612673e23edb5d9a82b264f68c3a77ff728ca3c1faff8a7f6ff1d17a1c9afb4e5b178783858896398987a9a8ab57b2fded6bc975bc51db0d6d59ee0')

prepare() {
  cd $pkgname

  patch -p1 < "$srcdir/pcre.patch"
}

build() {
  cd $pkgname

  ./configure --prefix=/usr/share/amap/

  make
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/share/$pkgname/etc"

  install -Dm 755 $pkgname "$pkgdir/usr/bin/$pkgname"
  ln "$pkgdir/usr/bin/$pkgname" "$pkgdir/usr/bin/${pkgname}6"
  install -Dm 755 amapcrap "$pkgdir/usr/bin/amapcrap"
  install -Dm 644 appdefs.* "$pkgdir/usr/share/$pkgname/etc"
  install -Dm 644 "$pkgname.1" "$pkgdir/usr/share/man/man1/$pkgname.1"
  install -Dm 644 LICENCE.AMAP "$pkgdir/usr/share/licenses/$pkgname/LICENCE"
}

